home *** CD-ROM | disk | FTP | other *** search
/ Aminet 38 / Aminet 38 (2000)(Schatztruhe)[!][Aug 2000].iso / Aminet / dev / c / CLib-SDI.lha / CLib-SDI / testsource / Test.c next >
Encoding:
C/C++ Source or Header  |  2000-06-25  |  1.3 KB  |  53 lines

  1. /* Programmheader
  2.  
  3.     Name:        Test.c
  4.     Main:        example
  5.     Versionstring:    $VER: Test.c 1.0 (25.06.2000)
  6.     Author:        SDI
  7.     Distribution:    Freeware
  8.     Description:    the example library test program
  9.  
  10.  1.0   25.06.00 : created that example library code
  11. */
  12.  
  13. #include <proto/example.h>
  14. #include <proto/dos.h>
  15. #include <proto/exec.h>
  16.  
  17. /* use global library, as this works for all compilers! */
  18. struct ExampleBase *ExampleBase = 0;
  19.  
  20. void main(int argc, char **argv)
  21. {
  22.   if((ExampleBase = (struct ExampleBase *) OpenLibrary("example.library", 1)))
  23.   {
  24.  
  25.     ex_TestRequest("Test Message", "It really works!", "OK");
  26.  
  27.     {
  28. #if defined(__SASC) || defined(__STORM__) || defined(__GNUC__)
  29.       ex_TestRequest2("Test Message Number 2",
  30.       "It worked %ld times now.\n"
  31.       "You called the programm '%s' with %ld arguments", "OK",
  32.       ExampleBase->exb_NumCalls, argv[0], argc-1);
  33. #else
  34.       struct {
  35.         ULONG  a;
  36.         STRPTR b;
  37.         ULONG  c;
  38.       } CallArgs;
  39.       CallArgs.a = ExampleBase->exb_NumCalls;
  40.       CallArgs.b = argv[0];
  41.       CallArgs.cc = argc-1;
  42.       ex_TestRequest2A("Test Message Number 2",
  43.       "It worked %ld times now.\n"
  44.       "You called the programm '%s' with %ld arguments", "OK", &a);
  45. #endif
  46.     }
  47.  
  48.     CloseLibrary((struct Library *) ExampleBase);
  49.   }
  50.   else
  51.     Printf("Failed to open example.library\n");
  52. }
  53.